package com.me.brainlessbirds.screens;

import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.InputEvent;
import com.badlogic.gdx.scenes.scene2d.utils.ClickListener;

public class MenusButton extends Actor
{
	protected TextureRegion	rgn			= new TextureRegion();
	public boolean			selected	= false;

	public MenusButton(Texture txt, float x, float y, float width, float height)
	{

		rgn = new TextureRegion(txt);

		this.setSize(width, height);
		float FW = this.getWidth() / 2;
		float FH = this.getHeight() / 2;
		this.setOrigin(FW, FH);
		this.setPosition((x - this.getWidth() / 2), (y - this.getHeight() / 2));
		this.setColor(getColor().r, getColor().g, getColor().b, getColor().a / 2f);

		this.addListener(new ClickListener()
		{
			@Override
			public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
			{
				selected = true;
				return false;
			}
		});

	}

	@Override
	public void draw(SpriteBatch batch, float parentAlpha)
	{
		batch.draw(rgn, getX(), getY(), getOriginX(), getOriginY(), getWidth(), getHeight(), getScaleX(), getScaleY(), getRotation());
	}
}
